home *** CD-ROM | disk | FTP | other *** search
/ Gekkan Dennou Club 140 / Gekkan Dennou Club - 2000.1 Vol. 140 (Japan).7z / Gekkan Dennou Club - 2000.1 Vol. 140 (Japan) (Track 1).bin / tools / xpicw / xpicw110.lzh / FPIC / MAKE_SRC.c < prev    next >
Text File  |  1995-07-18  |  2KB  |  144 lines

  1. #include <stdlib.h>
  2. #include <stdio.h>
  3.  
  4. /*
  5.  
  6.             MAKE_SRC.C
  7.  
  8.     ~Sys_Fpic.hasの連鎖展開部分(の一部)のソースを自動作成~
  9.  
  10. */
  11.  
  12.  
  13.  
  14. int c[5];
  15.  
  16. main()
  17. {
  18.     int z,i,u,q,w,a;
  19.     int p,y,m;
  20.     for(z=0;z<=255;z++){
  21.  
  22.         p=0;
  23.         y=0;
  24.         m=0;
  25.         w=8;
  26.         q=z;
  27.         for(;;){
  28.             if((w>=2) && ((q & 0xc0)==0x40)){
  29.                 c[m++]=1;
  30.                 y+=1024;
  31.                 p-=2;
  32.                 q=q<<2;
  33.                 w-=2;
  34.             }
  35.             if((w>=2) && ((q & 0xc0)==0x80)){
  36.                 c[m++]=2;
  37.                 y+=1024;
  38.                 q=q<<2;
  39.                 w-=2;
  40.             }
  41.             if((w>=2) && ((q & 0xc0)==0xc0)){
  42.                 c[m++]=3;
  43.                 y+=1024;
  44.                 p+=2;
  45.                 q=q<<2;
  46.                 w-=2;
  47.             }
  48.             if((w==2) && ((q & 0xc0)==0x00)){
  49.                 c[m++]=4;
  50.                 w-=2;
  51.                 q=q<<2;
  52.             }
  53.             if((w>=3) && ((q & 0xe0)==0)){
  54.                 c[m++]=0;
  55.                 w-=3;
  56.                 q=q<<3;
  57.                 break;
  58.             }
  59.             if((w>=4) && ((q & 0xf0)==0x20)){
  60.                 c[m++]=5;
  61.                 y+=1024;
  62.                 p-=4;
  63.                 q=q<<4;
  64.                 w-=4;
  65.             }
  66.             if((w>=4) && ((q & 0xf0)==0x30)){
  67.                 c[m++]=6;
  68.                 y+=1024;
  69.                 p+=4;
  70.                 q=q<<4;
  71.                 w-=4;
  72.             }
  73.             if(w<2)break;
  74.         }
  75.  
  76.         printf("J_");
  77.         a=0;
  78.         for(u=7;u>=0;u--){
  79.             if(u>w-1){
  80.                 printf("%c",((z>>u)&1)+'0');
  81.             }else{
  82.                 printf("x");
  83.                 a=a+1;
  84.             }
  85.         }
  86.         printf(":\t*");
  87.         z=z+(1<<a)-1;
  88.  
  89.         for(i=0;i<m;i++){
  90.             if(c[i]==0)printf("終");
  91.             if(c[i]==1)printf("左1/");
  92.             if(c[i]==2)printf("中1/");
  93.             if(c[i]==3)printf("右1/");
  94.             if(c[i]==4)printf("00/");
  95.             if(c[i]==5)printf("左2/");
  96.             if(c[i]==6)printf("右2/");
  97.         }
  98.         printf("\n");
  99.  
  100.         if(m!=1){
  101.             printf("        lea    %d%+d(a2),a2\n",y,p);
  102.         }
  103.         y = -y;
  104.         p = -p;
  105.  
  106.         for(i=0;i<m;i++){
  107.             if(c[i]==0){
  108.                 printf("        CHAIN_EX%d\n",w);
  109.                 break;
  110.             }
  111.             if(c[i]==1){
  112.                 y=y+1024;
  113.                 p=p-2;
  114.                 printf("        move.w    #UpR1,%d%+d(a2)\n",y,p);
  115.             }
  116.             if(c[i]==2){
  117.                 y=y+1024;
  118.                 printf("        move.w    #UpC,%d%+d(a2)\n",y,p);
  119.             }
  120.             if(c[i]==3){
  121.                 y=y+1024;
  122.                 p=p+2;
  123.                 printf("        move.w    #UpL1,%d%+d(a2)\n",y,p);
  124.             }
  125.             if(c[i]==4){
  126.                 printf("        CHAIN00X\n");
  127.                 break;
  128.             }
  129.             if(c[i]==5){
  130.                 y=y+1024;
  131.                 p=p-4;
  132.                 printf("        move.w    #UpR2,%d%+d(a2)\n",y,p);
  133.             }
  134.             if(c[i]==6){
  135.                 y=y+1024;
  136.                 p=p+4;
  137.                 printf("        move.w    #UpL2,%d%+d(a2)\n",y,p);
  138.             }
  139.             if(i==(m-1))printf("        CHAIN_NEXT\n");
  140.         }
  141.         printf("\n");
  142.     }
  143. }
  144.